<template>
	<view class="g-wrapper">
		<image :src="bUrl+newsDetail.cover" style="width: 100%;" mode=""></image>
		<view class="">{{newsDetail.title}}</view>
		<view class="" v-html="newsDetail.content"></view>
	</view>
</template>

<script>
	import {baseURL, requestNewsDetail} from '../../api/requestUtil.js'
	export default {
		data() {
			return {
				newsDetail:{},
				bUrl:baseURL
			}
		},
		methods: {
			getNewsDetail(id){
				requestNewsDetail(id).then(res=>{
					console.log('res >> ',res);
					const data = res.data
					if(data.code == 200){
						const newDetail = data.data //新闻对象
						this.newsDetail = newDetail
						
					}
				})
			}
		},
		// 页面生命周期
		onLoad(option) {
			console.log('option ',option);
			const id = option.id // 新闻ID
			this.getNewsDetail(id)
		}
	}
</script>

<style scoped>
.g-wrapper{
	padding: 10px;
}
</style>
